﻿using ProtoBuf;
using SyncDemo.Sync.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SyncCore.Sync.Models
{
    ///<summary>大厅信息。</summary>
    [ProtoContract]
    public class ClientHallSummaryInfo
    {
        [ProtoMember(1)]
        public AddressPortInfo[] IdleBoardcasts { get; set; }

        [ProtoMember(2)]
        public AddressPortInfo[] Servers { get; set; }


        public ClientHallSummaryInfo()
        {
            IdleBoardcasts = Array.Empty<AddressPortInfo>();
            Servers = Array.Empty<AddressPortInfo>();
        }


        public override string ToString()
        {
            var sb = new StringBuilder();

            sb.AppendLine("IdleBoardcasts:");

            if (IdleBoardcasts.Length == 0)
            {
                sb.AppendLine("null");
            }

            foreach (var item in IdleBoardcasts) 
            {
                sb.AppendLine(item.ToString());
            }

            sb.AppendLine("Servers:");

            if(Servers.Length == 0)
            {
                sb.AppendLine("null");
            }

            foreach (var item in Servers)
            {
                sb.AppendLine(item.ToString());
            }

            return sb.ToString();
        }
    }
}
